package com.lucy.disk.controller;

import com.lucy.disk.loader.OfficeServiceLoader;
import com.lucy.disk.loader.StorageServiceLoader;
import com.lucy.disk.service.FileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Map;

@Controller
@RequestMapping("disk")
@Api(tags = "编辑服务")
public class EditorController {
    @Autowired
    OfficeServiceLoader officeService;

    @Autowired
    FileService fileService;

    @Autowired
    StorageServiceLoader storageService;

    @GetMapping("editor/{documentKey}")
    @ApiOperation(value = "文档编辑",notes = "")
    public ModelAndView documentEditor(@PathVariable("documentKey") String documentKey, HttpServletResponse response) throws IOException {

        return officeService.loadEditorView(documentKey,response);
    }



}
